/**
 * Copyright 2009 University of  Washington
 * This code is released under the GPL version 3 - with a copy of the license included
 * @author Maya Hao Li
 *
 */
package seedpod.webapp.view.htmlwidget;

/**
 * <p>Title: single cell recording data entry </p>
 * <p>Description: web based data entry</p>
 * <p>Copyright: Copyright (c) 2003</p>
 * <p>Company: UW Biostructure</p>
 * @author not attributable
 * @version 1.0
 */

public class HtmlLink extends GenericHtmlWidget
{
  private String _href ;
  private Object _anchorDisplay;
  private String _js;
  

  public HtmlLink( String href, Object obj )
  {
    _href = href;
    _anchorDisplay = obj;
  }

  public String startTag( String href )
  {
    String lnk = "<a " + ATT("href", href);
    if ( _cssClass.length() > 0 )
    	lnk += " class=\"" + _cssClass + "\" ";
    if ( _widgetID.length() > 0 )
    	lnk += " id=\"" + _widgetID + "\"";
    if ( _js != null )
    	lnk += " " + _js ;
    lnk += ">";
    return lnk;
  }
  
  public void setJsCommand( String js ) {
	  _js = js;
  }


  public String endTag ()
  {
    return "</a>";
  }

  public String render()
  {
    String lnk = startTag (_href);
    lnk += _anchorDisplay.toString();
    lnk += endTag();
    return lnk;
  }

}